FROM registry.cn-shanghai.aliyuncs.com/jay-ant/python:3.10-slim-bullseye

LABEL maintainer="foo@bar.com"

ENV BUILD_PREFIX=/app
ENV TZ=Asia/Shanghai



WORKDIR ${BUILD_PREFIX}

COPY requirements.txt ${BUILD_PREFIX}/

RUN sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list

RUN cd ${BUILD_PREFIX} \
    && /usr/local/bin/python3 -m pip config set global.index-url https://mirrors.aliyun.com/pypi/simple \
    && /usr/local/bin/python3 -m pip install --no-cache --upgrade pip \
    && pip3 install --no-cache -r requirements.txt \
    && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

COPY . ${BUILD_PREFIX}/

# Create static directory for FastAPI static files mount
RUN mkdir -p ${BUILD_PREFIX}/static

EXPOSE 8000

ENTRYPOINT ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]